package org.jeecg.modules.common;

import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import sun.rmi.runtime.Log;

public class GetUserInfoUtils {

    public static LoginUser getLoginUser(){
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        return user;
    }

    public static String getLoginUserName(){
        LoginUser user = getLoginUser();
        if(user==null){
            return "";
        }
        return user.getUsername();
    }

    public static String getLoginUserId(){
        LoginUser user = getLoginUser();
        if(user==null){
            return "";
        }
        return user.getId();
    }
}
